//
//  TitleViewController.m
//  SportsApp
//
//  Created by Kevin Wong on 2012-12-18.
//  Copyright (c) 2012 Matthew Moritz. All rights reserved.
//

#import "TitleViewController.h"
#import "MainViewController.h"

@interface TitleViewController ()

@end

@implementation TitleViewController
@synthesize progressBar;
@synthesize time;
@synthesize timer;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void) updateTimer
{
    float newProgress = [self.progressBar progress] + 0.05;
    
    if(newProgress < 1.0)
        [self.progressBar setProgress:newProgress animated:YES];
    else {
        [timer invalidate];
        [self performSegueWithIdentifier:@"ToMainPage" sender:self];
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    progressBar.progress = 0;
    time = 0;
    timer =  [NSTimer scheduledTimerWithTimeInterval: 0.1f
                                             target:self
                                           selector:@selector(updateTimer) userInfo:nil repeats:YES];
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
